fix(k8s_utils): close namespace file handle with context manager#1033
Conversation
get_current_namespace() opened the in-cluster namespace file with a bare open() call, leaking a file descriptor on every invocation in long-running processes. Replace with a with statement to guarantee the file is closed on exit. Fixes RHOAIENG-54703 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1033 +/- ##
=======================================
Coverage 96.15% 96.15%
=======================================
Files 23 23
Lines 2238 2238
=======================================
Hits 2152 2152
Misses 86 86 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/lgtm |
|
/approve Change looks good — correct use of context manager, semantically equivalent to the original. Given the function is |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: laurafitzgerald The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
e1110cf
into
project-codeflare:main
get_current_namespace() opened the in-cluster namespace file with a bare open() call, leaking a file descriptor on every invocation in long-running processes. Replace with a with statement to guarantee the file is closed on exit.
Fixes RHOAIENG-54703
Issue link
What changes have been made
Verification steps
Checks